package engine.systems.spatial.spatial
{
	import ash.core.Component;

	public class Spatial extends Component
	{
		public var x:Number;
		public var y:Number;
		public var rotation:Number;
		public var scaleX:Number;
		public var scaleY:Number;
		
		/**
		 * Determines whether an Entity's Spatial component get synced with its Render
		 * component when added to the Render System.
		 */
		public var sync:Boolean;
		
		public function Spatial(x:Number = 0, y:Number = 0, rotation:Number = 0, scaleX:Number = 1, scaleY:Number = 1, sync:Boolean = true)
		{
			this.x 			= x;
			this.y 			= y;
			this.rotation 	= rotation;
			this.scaleX 	= scaleX;
			this.scaleY 	= scaleY;
			
			this.sync 		= sync;
		}
		
		override public function destroy():void { }
		
		public function set scale(scale:Number):void
		{
			this.scaleX = scale;
			this.scaleY = scale;
		}
		
		public function toString():String
		{
			return "[Spatial: X=" + x.toFixed(2) + ", Y=" + y.toFixed(2) + ", Rotation=" + rotation.toFixed(2) + "]";
		}
	}
}